package com.qingke.oo;

public class MovablePoint extends Point{
	private float xSpeed = 0;
	private float ySpeed = 0;
	
	public MovablePoint(float x,float y,float xSpeed,float ySpeed){
		this.setXY(x, y);
		this.xSpeed = xSpeed;
		this.ySpeed = ySpeed;
	}
	
	public MovablePoint(float xSpeed,float ySpeed){
		this.xSpeed = xSpeed;
		this.ySpeed = ySpeed;
	}
	
	public MovablePoint(){
		
	}
	
	public float getXSpeed(){
		return xSpeed;
	}
	
	public float getYSpeed(){
		return ySpeed;
	}
	
	public void  setXSpeed(float xSpeed){
		this.xSpeed = xSpeed;
	}
	
	public void setYSpeed(float ySpeed){
		this.ySpeed = ySpeed;
	}
	
	public void setSpeed(float xSpeed,float ySpeed){
		this.xSpeed = xSpeed;
		this.ySpeed = ySpeed;
	}
	
	public float[] getSpeed(){
		float[] i = new float[2];
		i[0] = xSpeed;
		i[1] = ySpeed;
		return i;
	}
	
	public String toString(){
		return "("+this.getX()+","+this.getY()+")"+",speed=("+xSpeed+","+ySpeed+")";
	}
	
	public MovablePoint  move(){
		this.setX(this.getX()+xSpeed);
		this.setY(this.getY()+ySpeed);
		return this;
	}
}
